﻿using Com.JunCaiSoft.Common.Enums;
using Com.JunCaiSoft.Common.ExchangeData;
using Com.JunCaiSoft.Common.Struct;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;

namespace Com.JunCaiSoft.Common.IDao
{
    public interface IQueryDaoAsync<T> : IGetDaoAsync<T> where T : class, new()
    {

        Task<List<T>> ListAsync();
        Task<List<T>> ListAsync(Expression<Func<T, bool>> where);
        Task<List<T>> ListAsync<TKey>(Expression<Func<T, TKey>> orderBy, OrderbyType orderType = OrderbyType.ase);
        Task<List<T>> ListAsync<TKey>(Expression<Func<T, bool>> where, Expression<Func<T, TKey>> orderBy, OrderbyType orderType = OrderbyType.ase);
        Task<List<T>> ListAsync(Expression<Func<T, bool>> condition, params OrderModelField[] orderByExpression);

        Task<List<TEntity>> ListAsync<TEntity, TKey>() where TEntity : class, new();
        Task<List<TEntity>> ListAsync<TEntity, TKey>(Expression<Func<TEntity, bool>> where) where TEntity : class, new();
        Task<List<TEntity>> ListAsync<TEntity, TKey>(Expression<Func<TEntity, TKey>> orderBy, OrderbyType orderType = OrderbyType.ase) where TEntity : class, new();
        Task<List<TEntity>> ListAsync<TEntity, TKey>(Expression<Func<TEntity, bool>> where, Expression<Func<TEntity, TKey>> orderBy, OrderbyType orderType = OrderbyType.ase) where TEntity : class, new();
        Task<List<TEntity>> ListAsync<TEntity>(Expression<Func<TEntity, bool>> condition, params OrderModelField[] orderByExpression) where TEntity : class, new();

        Task<IQueryable<TEntity>> QuerySQLAsync<TEntity>(string sql, params object[] parameters) where TEntity : class, new();
    }
}
